<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>新闻活动详情</title>
		<meta name="keywords" content="Bootstrap模版,Bootstrap模版下载,Bootstrap教程,Bootstrap中文" />
		<meta name="description" content="站长素材提供Bootstrap模版,Bootstrap教程,Bootstrap中文翻译等相关Bootstrap插件下载" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<!-- basic styles -->

		<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
        <link rel="stylesheet"  href="assets/css/kkpager_orange.css" />

		<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

		<!-- page specific plugin styles -->

		<!-- ace styles -->

		<link rel="stylesheet" href="assets/css/ace.min.css" />
		<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="assets/css/ace-skins.min.css" />

		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="assets/js/ace-extra.min.js"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="assets/js/html5shiv.js"></script>
		<script src="assets/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body>
		<#include "header.ftl"/>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

            <#include "left_list_menu.ftl">
                <div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
                                <a href="selectNewsList">新闻管理</a>
							</li>
							<li>
								新闻活动详情
							</li>
						</ul><!-- .breadcrumb -->

					</div>

                    <div class="page-content">
                        <div class="page-header">
                            <#--<h1>-->
                                <#--新闻管理-->
                                <#--<small>-->
                                    <#--<i class="ace-icon fa fa-angle-double-right"></i>-->
                                    <#--<a href="selectCustomerList?page=1">新闻活动详情</a>-->
                                <#--</small>-->
                            <#--</h1>-->
                        </div><!-- /.page-header -->

                        <!-- 客户基本信息 -->
                        <div class="row">
                            <div class="col-xs-12 col-sm-12">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">
                                            基本信息
                                            <button type="button" class="btn btn-primary btn-xs" id="saveNewsManage" style="float: right;margin-top:-6px;"> 保 存 </button>
                                        </h4>
                                    </div>
                                    <div class="panel-body">
                                        <form role="form" id="info" class="form-horizontal">
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label"></label>
                                                <div class="col-sm-6">
                                                <span id="image_area" style="display:inline-block;margin-bottom: 10px;padding:3px;border:1px solid #8089a0;border-radius: 6px">
                                                    <img  class="editable img-responsive editable-click editable-empty" src="http://121.41.47.67:8080/imgs/${newManage.img_name !""}" alt="照片"  style="display: block;width:100px;heigth:120px"/>
                                                </span>
													<input type="file" value="sdgsdg" id="demo_input" style="margin-top: 10px;" />
                                                </div>

                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">编号 :</label>
                                                <div class="col-sm-4">
                                                    <p class=" form-control-static" id="news_id" >${newManage.id !""}</p>
                                                </div>

                                                <label class="col-sm-2 control-label">标题 :</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" id="title" name="title" value="${newManage.title !""}" placeholder=""/>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">链接 :</label>
                                                <div class="col-sm-4">
                                                    <input type="text" class="form-control" id="content" name="content" value="${newManage.content !""}" placeholder=""/>
                                                </div>

                                                <label class="col-sm-2 control-label">创建时间 :</label>
                                                <div class="col-sm-3">
                                                    <p class=" form-control-static" id="customer_id" >${newManage.createtime?number?number_to_date !""}</p>
                                                </div>
                                            </div>
                                            <div class="form-group" >
                                                <label class="col-sm-2 control-label">创建推送消息 :</label>
                                                <div class="col-sm-4">
                                                   <input type="text" id="text" name="text" value="${newManage.text !""}">
                                                </div>
                                                <label class="col-sm-2 control-label">上次修改时间 :</label>
                                                <div class="col-sm-3">
                                                    <p class=" form-control-static" >${newManage.updateTime?datetime !""}</p>
                                                </div>
                                            </div>
                                        </form>
                                        <#--<div class="form-group">
                                            <label class="col-sm-1 control-label">请输入推送消息 :</label>
                                        <textarea id="text" class="col-sm-8"></textarea>
                                            <button  class="btn btn-primary btn-xs" id="tuisong" style="float: right;margin-top:-6px;">推送</button>
                                        </div>-->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.page-content -->
				</div><!-- /.main-content -->

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<!-- basic scripts -->


		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
        <script type="text/javascript" src="assets/js/jquery-1.10.2.min.js"></script>
		<script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->

		<script src="assets/js/jquery.dataTables.min.js"></script>
		<script src="assets/js/jquery.dataTables.bootstrap.js"></script>

		<!-- ace scripts -->

		<script src="assets/js/ace-elements.min.js"></script>
		<script src="assets/js/ace.min.js"></script>

        <script type="text/javascript" src="assets/js/kkpager.min.js"></script>

        <script src="assets/js/myJs.js"></script>
		<!-- inline scripts related to this page -->

        <script src="assets/js/jquery.cookie.js"></script>
        <script type="text/javascript">
            window.onload=function(){
                var name = $.cookie('username');
                if (name == '' || name == null || typeof(name)=="undefined"){
                    document.getElementById("user_name").innerText="unknown user";
                    alert("请先登录");
                    window.location.href='login';
                }

                document.getElementById("user_name").innerText=name;
            }


            //上传头像
            $("#demo_input").unbind("change").change(function(event) {
                var file = event.target.files[0];
                readFile1(file, "demo_input");
            });

            //读取文件
            function readFile1(file, input_name) {
                if(file == undefined) {
                    return false;
                }
                var file_size = Math.round(file.size / 1024 * 100) / 100; //kb
                var pic_name = file.name;
                //这里我们判断下类型如果不是图片就返回 去掉就可以上传任意文件
                if(!/image\/\w+/.test(file.type)) {
                    alert("请确保文件为图像类型");
                    $("#" + input_name).val("");
                    return false;
                }
                if(file_size > 2000) {
                    alert("上传文件的大小必须小于2MB!");
                    $("#" + input_name).val("");
                    return false;
                } else {
                    var reader = new FileReader();
                    var c = reader.readAsDataURL(file);
                    reader.onload = function(e) {
                        var result = this.result;
                        var base64 = result.split(",")[1];
                        if(input_name == "demo_input") {
                            submit_pic(pic_name, base64);
                        }
                    }
                }
            }

            function submit_pic(pic_name, base64) {
                var hz = "." + pic_name.split(".")[1];
                var id = ${newManage.id !""};
                $.ajax({
                    url:"updateUploadingNewsImg?",
                    type: "POST",
                    dataType: "json",
                    data: {"file":base64,"suf":hz,"id":id},
                    success: function(data) {
                        if(data.status == "200") {
                            //alert(data.info);
                            //debugger;
                            window.location.reload();
                        } else {
                            alert(data.info);
                        }
                    },
                    error: function() {
                        alert("服务端错误！");
                    }
                });
            }

            $("#saveNewsManage").click(function () {
                var id = ${newManage.id !""};
                var title = $("#title").val();
                var content = $("#content").val();
                var t = $("#text").val();

                $.ajax({
                    type:"POST",
                    url:"updateNews",
                    data:{"id" : id,"title" : title,"content" : content ,"text" : t},
                    dataType:'json',
                    success:function(data){
                        if(data.status == 200){
                            alert("成功！");
                            window.location.reload();
                        }else{
                            alert(data.info);
                            return false;
                        }
                    },
                    error: function () {
                        alert("服务端出错！");
                        return false;
                    }
                });

            })

			jQuery(function($) {
				var oTable1 = $('#sample-table-2').dataTable( {
				"aoColumns": [
			      { "bSortable": false },
			      null, null,null, null, null,
				  { "bSortable": false }
				] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
			
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			})
           /* $("#tuisong").click(function(){
                if(confirm("你确定要全部推送吗?")) {
                    $.ajax({
                        var t = $("#text").val();
                    url:"tuiSong",
                            type
                :
                    "POST",
                            dataType
                :
                    "json",
                            data
                :
                    {
                        "text"
                    :
                        t
                    }
                ,
                    success: function (data) {
                        if (data.status == "200") {
                            alert("推送成功！")
                            window.location.reload();
                        } else {
                            alert(data.info);
                        }
                    }
                ,
                    error: function () {
                        alert("服务端错误！");
                    }
                })
                    ;

                }
            })
*/

		</script>
<#--<script type="text/javascript">-->
<#--var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");-->
<#--document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fe9e1d61340ff3d9495a8cca04ebdb49d' type='text/javascript'%3E%3C/script%3E"));-->
<#--</script>-->
<#--<a href="http://www.iteblog.com">过往记忆</a>-->
</body>
</html>
